﻿<Window x:Class="ScreenCatcher.View.Settings"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:ScreenCatcher.ViewModel;assembly=ScreenCatcher.ViewModel"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
        Width="500" 
        Height="370"
        Title="Настройки"
        ResizeMode="NoResize"
        Style="{StaticResource ChromeWindowStyle}"
        d:DataContext="{d:DesignInstance vm:SettingsViewModel}"
        vm:WindowProperties.DialogResult="{Binding CloseWindowFlag}"
        vm:WindowProperties.MaximizeVisibility="Collapsed">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <GroupBox Header="Общие" Grid.Row="0">
                <Grid Grid.Row="0">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid Grid.Row="0">
                        <TextBlock
                            Margin="5"
                            Text="Имя файла по умолчанию:" 
                            HorizontalAlignment="Left"/>
                        <TextBox
                            Margin="5 5 80 5"
                            Width="150"
                            Text="{Binding Path=DefaultFileName, Mode=TwoWay}"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top"/>
                        <ComboBox
                            Width="70"
                            ItemsSource="{Binding Path=Extensions}"
                            SelectedItem="{Binding Path=Extension}"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top"/>
                    </Grid>
                    <Grid Grid.Row="1">
                        <CheckBox x:Name="SuffixCheck"
                                  IsChecked="{Binding Path=UseSuffix, Mode=TwoWay}"
                                  Content="Использовать суффикс в имени файла"
                                  HorizontalAlignment="Left"
                                  Margin="5"/>
                        <StackPanel
                            Orientation="Horizontal"
                            HorizontalAlignment="Right">
                            <RadioButton
                                Content="Текущая дата"
                                IsChecked="{Binding Path=UseDate, Mode=TwoWay}"
                                Margin="5 5 65 5"/>
                            <RadioButton
                                Content="Guid"
                                IsChecked="{Binding Path=UseGuid, Mode=TwoWay}"
                                Margin="0 5 30 5"/>
                            <StackPanel.Style>
                                <Style TargetType="{x:Type StackPanel}">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=IsChecked, ElementName=SuffixCheck}" Value="False">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>
                        </StackPanel>
                    </Grid>
                    <Grid Grid.Row="2">
                        <CheckBox x:Name="RunAsCheck"
                                  IsChecked="{Binding Path=RunAs, Mode=TwoWay}"
                                  Content="Редактировать с помощью Paint"
                                  HorizontalAlignment="Left" />
                        <!--<StackPanel
                            Orientation="Horizontal"
                            HorizontalAlignment="Right">
                            <RadioButton
                                Margin="5 5 63 5"
                                Content="ScreenCatcher"
                                IsChecked="{Binding Path=InSelf, Mode=TwoWay}"/>
                            <RadioButton
                                Content="Paint"
                                IsChecked="{Binding Path=InPaint, Mode=TwoWay}"
                                Margin="0 5 28 5"/>
                            <StackPanel.Style>
                                <Style TargetType="{x:Type StackPanel}">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=IsChecked, ElementName=RunAsCheck}" Value="False">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>
                        </StackPanel>-->
                    </Grid>
                    <Grid
                        Grid.Row="3">
                        <CheckBox
                            IsChecked="{Binding Path=UseNotification, Mode=TwoWay}"
                            Content="Включить уведомления"
                            HorizontalAlignment="Left" />
                    </Grid>
                </Grid>
            </GroupBox>
            <GroupBox 
                Grid.Row="1"
                Header="Сохранение без подверждения">
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <ComboBox
                            Width="100"
                            ItemsSource="{Binding Keys}"
                            SelectedItem="{Binding Path=ScreenCatchKey}" />
                        <ComboBox
                            Width="100"
                            ItemsSource="{Binding ModifierKeys}"
                            SelectedItem="{Binding Path=ScreenCatchModifierKey}" />
                    </StackPanel>
                    <Grid>
                        <CheckBox x:Name="PathCheckBox"
                                  Margin="5"
                                  Content="Путь сохранения"
                                  HorizontalAlignment="Left"
                                  VerticalAlignment="Center"
                                  IsChecked="{Binding Path=IsStorePath, Mode=TwoWay}" />
                        <TextBox
                            Margin="5"
                            Width="225"
                            Text="{Binding Path=DefaultPath, Mode=TwoWay}"
                            HorizontalAlignment="Right">
                            <TextBox.InputBindings>
                                <MouseBinding MouseAction="LeftClick" Command="{Binding SetDefaultPathCommand}"/>
                            </TextBox.InputBindings>
                            <TextBox.Style>
                                <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=IsChecked, ElementName=PathCheckBox}" Value="False">
                                            <Setter Property="Visibility" Value="Hidden" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBox.Style>
                        </TextBox>
                    </Grid>
                </StackPanel>
            </GroupBox>
            <StackPanel Orientation="Horizontal" Grid.Row="2">
                <GroupBox Header="Сохранение с подверждением" Margin="5">
                    <StackPanel Orientation="Horizontal">
                        <ComboBox
                            Width="100"
                            ItemsSource="{Binding Keys}"
                            SelectedItem="{Binding Path=ScreenCatchWithConfirmationKey}" />
                        <ComboBox
                            Width="100"
                            ItemsSource="{Binding ModifierKeys}"
                            SelectedItem="{Binding Path=ScreenCatchWithConfirmationModifierKey}" />
                    </StackPanel>
                </GroupBox>
                <GroupBox Header="Сохранение активного окна" Margin="5">
                    <StackPanel Orientation="Horizontal">
                        <ComboBox
                            Width="100"
                            ItemsSource="{Binding Keys}"
                            SelectedItem="{Binding Path=ScreenCatchCurrentWindowKey}" />
                        <ComboBox
                            Width="100"
                            ItemsSource="{Binding ModifierKeys}"
                            SelectedItem="{Binding Path=ScreenCatchCurrentWindowModifierKey}" />
                    </StackPanel>
                </GroupBox>
            </StackPanel>
        </Grid>
        <StatusBar
            Grid.Row="1"
            HorizontalAlignment="Stretch"
            vm:WindowProperties.CanDragMove="True">
            <StatusBarItem HorizontalContentAlignment="Right">
                <StackPanel Orientation="Horizontal">
                    <Button
                        Width="50"
                        IsDefault="True"
                        Command="{Binding SaveSettingsCommand}"
                        Content="OK" />
                    <Button
                        Width="50"
                        IsCancel="True"
                        Command="{Binding CloseCommand}"
                        Content="Cancel" />
                </StackPanel>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Window>